package com.su.shareall.data;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

public class SinaXmlData {
	public static String fileName = "sinaxmldata";

	public static void storeKey(Context activity, String token,
			String expires_in, String remind_in, String uid) {
		SharedPreferences settings = activity.getSharedPreferences(fileName,
				Context.MODE_PRIVATE);
		SharedPreferences.Editor editor = settings.edit();
		editor.putString("token", token);
		editor.putString("expires_in", expires_in);
		editor.putString("remind_in", remind_in);
		editor.putString("uid", uid);

		editor.commit();
	}

	public static void clear(Activity activity) {
		SharedPreferences settings = activity.getSharedPreferences(fileName,
				Context.MODE_PRIVATE);
		SharedPreferences.Editor editor = settings.edit();
		editor.clear();
		editor.commit();
	}

	public static String getToken(Context context) {
		SharedPreferences settings = context.getSharedPreferences(fileName,
				Context.MODE_PRIVATE);
		return settings.getString("token", "");
	}
}
